<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>定时器</title>
</head>
<body>
    <script>
        // 打印5个10
        var time1 = setInterval(function(){
            console.log(10);
        },1000);
        setTimeout(function(){
            clearInterval(time1);
        },5000);
    </script>
</body>
</html>